<template>
  <view class="flex-col page">
          <pickerAddress @change="change">
                <view class="image-wrapper">
                  <uni-icons type="location" size="40rpx"/>
                  <input class="text_5" name="city" v-model="selectedCity"
                         type="button" placeholder="请输入城市名、拼音或首字母查询"/>
                </view>
          </pickerAddress>
        </view>
</template>

z
<script>

import pickerAddress from '../../components/wangding-pickerAddress/wangding-pickerAddress.vue'
import AllAddress from '../../components/wangding-pickerAddress/data.js'
//修改账号信息：如实验室位置
//修改账号信息：如昵称
import {_modifylabolocation,_modifyname} from "@/service/user.js"
import UniIcons from "@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue";

export default {
  components: {UniIcons, pickerAddress, AllAddress},
  data() {
    return {
      city: '',
      selectedCity: '', // 保存选择的城市信息
      account_user: ''
    };
  },
  onLoad(options) {
    const {location} = options;
    if (location) {
      this.selectedCity = location;
    }
    this.account_user = this.$store.state.userInfo.accountNum;
  },
  methods: {
    change(data) {
      this.selectedCity = data.data.join('');
      this.savelocation();
    },
    async savelocation() {
      console.log(this.account_user, this.selectedCity)
      let res = await _modifylabolocation({
        account_user: this.account_user,
        laboratorylocation_user: this.selectedCity
      });
      console.log(res);
      if (res.flag == true) {
        this.$api.msg('修改成功')
      } else {
        this.$api.msg('修改失败')
      }
    }
  },
};
</script>

<style scoped lang="css">
.page {
  background-color: #ffffff;
  width: 100%;
  height: 100%;
}

.text_5 {
  flex: 1;
  color: #000000;
  font-size: 25rpx;
  height: 100%;
}

.image-wrapper {
  display: flex;
  align-items: center;
  background-color: #e5e5e580;
  height: 80rpx;
}
</style>
